package com.hanxing.kxcharge.module.operations.dal.mysql.station;

import com.hanxing.kxcharge.framework.common.pojo.PageResult;
import com.hanxing.kxcharge.framework.mybatis.core.mapper.BaseMapperX;
import com.hanxing.kxcharge.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hanxing.kxcharge.module.operations.controller.admin.station.vo.StationPageReqVO;
import com.hanxing.kxcharge.module.operations.dal.dataobject.station.StationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 站点信息 Mapper
 *
 * @author 航兴充电
 */
@Mapper
public interface StationMapper extends BaseMapperX<StationDO> {

    default PageResult<StationDO> selectPage(StationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StationDO>()
                .eqIfPresent(StationDO::getOrgId, reqVO.getOrgId())
                .likeIfPresent(StationDO::getStationName, reqVO.getStationName())
                .eqIfPresent(StationDO::getCountryCode, reqVO.getCountryCode())
                .eqIfPresent(StationDO::getProvinceCode, reqVO.getProvinceCode())
                .eqIfPresent(StationDO::getCityCode, reqVO.getCityCode())
                .eqIfPresent(StationDO::getAreaCode, reqVO.getAreaCode())
                .eqIfPresent(StationDO::getTownCode, reqVO.getTownCode())
                .likeIfPresent(StationDO::getAreaCodeName, reqVO.getAreaCodeName())
                .eqIfPresent(StationDO::getAddress, reqVO.getAddress())
                .eqIfPresent(StationDO::getServiceTel, reqVO.getServiceTel())
                .eqIfPresent(StationDO::getStationType, reqVO.getStationType())
                .eqIfPresent(StationDO::getStationStatus, reqVO.getStationStatus())
                .eqIfPresent(StationDO::getStationLng, reqVO.getStationLng())
                .eqIfPresent(StationDO::getStationLat, reqVO.getStationLat())
                .eqIfPresent(StationDO::getConstruction, reqVO.getConstruction())
                .eqIfPresent(StationDO::getStationAddress, reqVO.getStationAddress())
                .eqIfPresent(StationDO::getCapacitance, reqVO.getCapacitance())
                .eqIfPresent(StationDO::getShareType, reqVO.getShareType())
                .eqIfPresent(StationDO::getIsOccupationCost, reqVO.getIsOccupationCost())
                .eqIfPresent(StationDO::getOvertimeMoney, reqVO.getOvertimeMoney())
                .eqIfPresent(StationDO::getOvertimeMin, reqVO.getOvertimeMin())
                .eqIfPresent(StationDO::getSingleDeductionLimit, reqVO.getSingleDeductionLimit())
                .eqIfPresent(StationDO::getIsBrake, reqVO.getIsBrake())
                .eqIfPresent(StationDO::getParkExplain, reqVO.getParkExplain())
                .eqIfPresent(StationDO::getStationDescribe, reqVO.getStationDescribe())
                .eqIfPresent(StationDO::getServiceSetup, reqVO.getServiceSetup())
                .eqIfPresent(StationDO::getBaseSetup, reqVO.getBaseSetup())
                .eqIfPresent(StationDO::getOpenExplain, reqVO.getOpenExplain())
                .eqIfPresent(StationDO::getImgMainEntrance, reqVO.getImgMainEntrance())
                .eqIfPresent(StationDO::getImgFlagPath, reqVO.getImgFlagPath())
                .eqIfPresent(StationDO::getImgFullView, reqVO.getImgFullView())
                .eqIfPresent(StationDO::getImgPilesFeature, reqVO.getImgPilesFeature())
                .eqIfPresent(StationDO::getImgOther, reqVO.getImgOther())
                .eqIfPresent(StationDO::getQualification, reqVO.getQualification())
                .eqIfPresent(StationDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(StationDO::getIsEnableStart, reqVO.getIsEnableStart())
                .eqIfPresent(StationDO::getHotLine, reqVO.getHotLine())
                .eqIfPresent(StationDO::getStationCode, reqVO.getStationCode())
                .eqIfPresent(StationDO::getSumPower, reqVO.getSumPower())
                .eqIfPresent(StationDO::getStationServiceSets, reqVO.getStationServiceSets())
                .eqIfPresent(StationDO::getCostTemplateId, reqVO.getCostTemplateId())
                .eqIfPresent(StationDO::getProperty, reqVO.getProperty())
                .betweenIfPresent(StationDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(StationDO::getEquipmentOwnerId, reqVO.getEquipmentOwnerId())
                .orderByDesc(StationDO::getId));
    }

}
